export enum LogLevel {
    DEBUG,
    INFO,
    WARN,
    ERROR,
}
export class Logger {
    private _level: LogLevel
    private _console: Console
    constructor (level = LogLevel.ERROR) {
        this._level = level
        this._console = globalThis.console
    }
    log = (...data: unknown[]) => {
        if (this._level <= LogLevel.INFO) {
            this._console.log(...data)
        }
    }
    debug = (...data: unknown[]) => {
        if (this._level <= LogLevel.DEBUG) {
            this._console.debug(...data)
        }
    }
    info = (...data: unknown[]) => {
        if (this._level <= LogLevel.INFO) {
            this._console.info(...data)
        }
    }
    warn = (...data: unknown[]) => {
        if (this._level <= LogLevel.WARN) {
            this._console.warn(...data)
        }
    }
    error = (...data: unknown[]) => {
        if (this._level <= LogLevel.ERROR) {
            this._console.error(...data)
        }
    }
}

const logger = new Logger(LogLevel[__CONFIG__.LOG_LEVEL])
export default logger